<!--
 * @Author: HC
 * @Date: 2022-04-22 14:42:31
 * @LastEditTime: 2022-04-22 16:32:21
 * @Description: 
-->
<template>
  <div class="comparison">
    <div class="table">
      <el-table v-loading="tableLoading" border style="width: 100%" :cell-style="cellStyle" :header-cell-style="{
          background: '#0070C0',
          color: '#ffffff',
          padding: '0',
          height: '26px',
        }" :data="tableData">
        <el-table-column label="来源名称1" prop="incomeName1" align="center"></el-table-column>
        <el-table-column label="来源名称2" prop="incomeName2" align="center"></el-table-column>
        <el-table-column label="科目类别" prop="typeName2" align="center"></el-table-column>
        <el-table-column label="上月" prop="lastMonthIncome" align="center"></el-table-column>
        <el-table-column label="本月" prop="thisMonthIncome" align="center"></el-table-column>
        <el-table-column label="环比" prop="hbMonInreaseAmt" align="center"></el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
// import { hbSourceSubject } from "@/api/barCode/index";
import $barCodeApi from "@/api/barCode/index";

export default {
  name: "comparison",
  components: {},
  props: {
    form: {
      type: Object,
      default: {},
    },
  },

  data () {
    return {
      tableLoading: false,
      tableData: [],
    };
  },
  computed: {

  },
  created () { },
  mounted () { },
  methods: {
    cellStyle ({ row, column, rowIndex, columnIndex }) {
      if (rowIndex < (this.tableData.length / 2)) {
        return "background: #C6E0B4;padding:0;color:black;"
      } else {
        return "background: #FCE4D6;padding:0;color:black;"
      }
    },
    getList () {
      this.tableLoading = true;
      $barCodeApi.hbSourceSubject({ ...this.form }, res => {
        if (res.code == 0) {
          this.tableLoading = false;
          this.tableData = res.content;
        }
      });
      // hbSourceSubject(this.form).then((res) => {
      //   if (res.code == 0) {
      //     this.tableLoading = false;
      //     this.tableData = res.content;
      //   }
      // });
    },
  },
};
</script>

<style scoped lang="scss">
</style>
